Process Questions & Answers for Knowledge Base
Used to ingest structured Question and Answer (Q&A) pairs into the knowledge base. This is ideal for creating a knowledge base optimized for direct question answering.
API Endpoint
| Property | Value |
|---|---|
| Request Method | POST |
| Request URL | https://api.seliseblocks.com/kb/qa |
Request
Request Example
curl -X POST 'https://api.seliseblocks.com/kb/qa' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"project_key": "YOUR_PROJECT_KEY",
"agent_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"question": "How do I reset my password?",
"answer": "To reset your password, click on the Forgot Password link on the login page. Enter your email address, and you will receive a password reset link. Click the link in the email and follow the instructions to create a new password."
}'
Request Headers
| Field | Type | Required | Description |
|---|---|---|---|
| accept | string | Yes | Accepted response format. Use application/json |
| Content-Type | application/json | Yes | Data type, must be application/json. |
Request Body
Request Body Schema
{
"project_key": "string",
"agent_id": "string",
"question": "string",
"answer": "string"
}
Request Body Parameters
| Field | Type | Required | Description |
|---|---|---|---|
| project_key | string | Yes | The project key for your project. |
| agent_id | string | Yes | UUID of the AI agent to associate the Q&A pair with. |
| question | string | Yes | The question text to be indexed in the knowledge base. |
| answer | string | Yes | The answer text corresponding to the question. |
tip
Q&A pairs are particularly effective for:
- FAQs and common user queries
- Standardized responses to specific questions
- Product documentation in Q&A format
- Training the agent to respond accurately to known questions
Response
Success Response (200 OK)
Returns an object containing the processing status.
{
"is_success": true,
"detail": "Q&A pair processed and added to knowledge base successfully",
"error": {}
}
Response Fields
| Field | Type | Description |
|---|---|---|
| is_success | boolean | Indicates whether the Q&A processing was successful. |
| detail | string | Success or failure message with additional context. |
| error | object | Error details if the operation failed (empty if successful). |
note
The Q&A pair is indexed in a way that optimizes retrieval when users ask similar questions. The agent can use this structured information to provide accurate and consistent answers.
Error Response (422 Unprocessable Entity)
Returns validation error details when the request body is invalid.
{
"detail": [
{
"loc": [
"body",
"question"
],
"msg": "field required",
"type": "value_error.missing"
}
]
}
Error Response Fields
| Field | Type | Description |
|---|---|---|
| detail | array | Array of validation error objects. |
| loc | array | Location of the error in the request (e.g., body field). |
| msg | string | Human-readable error message. |
| type | string | Error type identifier. |
Error Codes
| Status Code | Description | Response Type |
|---|---|---|
| 200 | Successful Response | Success |
| 400 | Bad Request - Invalid Q&A data or processing error | Bad Request |
| 422 | Validation Error - Invalid request parameters | Unprocessable Entity |